#include <QGuiApplication>

#include <QQmlApplicationEngine>
#include <QQuickView>
#include <QQmlEngine>
#include <QQmlContext>
#include <QQuickItem>

#include "logutils.h"


int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication app(argc, argv);

    // 将日志保存到文件
//    LogUtils::GetInstance();
//    qInstallMessageHandler(messageOutput);

    // qt格式化日志信息 [参考：https://blog.csdn.net/sdhahaha945/article/details/110534321]
    qSetMessagePattern("[%{time yyyy-MM-dd hh:mm:ss.zzz}][%{type}] %{function}:%{line} - %{message}");

    QQuickView view;
    QObject::connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()), Qt::QueuedConnection);

    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setSource(QUrl("qrc:/qml/mainitem.qml"));
    view.show();

    return app.exec();
}
